<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<script>
	var setting = {
		data : {
			simpleData : {
				enable : true,
				idKey : "id",
				pIdKey:"pid",
				rootId : "0"
			}
		},
	callback:{
		onClick: zTreeOnClick
	}
	}
	function zTreeOnClick(event, treeId, treeNode) {
		var line ="<div class='checkbox-inline'><label> <input name='actorId' type='checkbox' checked='checked' value="+(treeNode.id-100)+">"+treeNode.name+" <i class='fa fa-square-o'></i></label></div>";
		$(".actorId").append(line);
	    //alert(treeNode.id + "," + treeNode.name);
	};
	$.ajax({
		url : "getEmployeetree",
		type : "get",
		dataType : "json",
		success : function(json) {
			$.fn.zTree.init($("#employeetTree"), setting, json);
		}
	}
)
</script>
	<script type="text/javascript">
		$(function(){
			$("#startTime").datetimepicker({
				format:"yyyy-mm-dd hh:ii",	//日期格式
				language:"zh-CN",	//国际化中文
				minView: "hour",		//只选择日期，不要时间
				autoclose:true
			});
			$("#endTime").datetimepicker({
				format:"yyyy-mm-dd hh:ii",	//日期格式
				language:"zh-CN",	//国际化中文
				minView: "hour",		//只选择日期，不要时间
				autoclose:true
			});
		});
	</script>
<div class="row">
	<div class="col-xs-12 col-sm-8">
		<div class="box">
			<div class="box-header">
				<div class="box-name">
					<i class="fa fa-search"></i> 
					<c:choose>
						<c:when test="${metting.id>0}">日程编辑</c:when>
						<c:otherwise>新建日程</c:otherwise>
					</c:choose>
					<span></span>
				</div>
				<div class="box-icons">
					<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
					</a> <a class="expand-link"> <i class="fa fa-expand"></i>
					</a> <a class="close-link"> <i class="fa fa-times"></i>
					</a>
				</div>
				<div class="no-move"></div>
			</div>
			<div class="box-content">
				<form id="defaultForm" method="post" action="mettingsave"
					class="form-horizontal">
					<c:if test="${metting.id>0}">
						<input type="hidden" name="id" class="paperId" value="${metting.id}"/>
					</c:if>
				
					<fieldset>
						<div class="form-group">
							<label class="col-sm-3 control-label">标题</label>
							<div class="col-sm-5">
									<input type="text" class="form-control" name="title" value="${metting.title}"/>
							</div>
						</div>		
								<div class="form-group">
							<label class="col-sm-3 control-label">内容</label>
							<div class="col-sm-5">
							<input type="text" class="form-control" name="description" value="${metting.description}"/>
							</div>	
							</div>
									<div class="form-group">
							<label class="col-sm-3 control-label">参与者</label>
							<div class="col-sm-5">
							<div  class="actorId" >
							</div>
							</div>	
							</div>
											<div class="form-group">
							<label class="col-sm-3 control-label">地点</label>
							<div class="col-sm-5">
							<input type="text" class="form-control" name="location" value="${metting.location}"/>
							</div>	
							</div>
									<div class="form-group">
							<label class="col-sm-3 control-label">开始时间</label>
							<div class="col-sm-5">
							<input type="text" class="form-control" name="startTime" value="${metting.startTime}" id="startTime"/>
							</div>	
							</div>
											<div class="form-group">
							<label class="col-sm-3 control-label">结束时间</label>
							<div class="col-sm-5">
							<input type="text" class="form-control" name="endTime" value="${metting.endTime}" id="endTime"/>
							</div>	
							</div>
											
						<input type="hidden" name="creatorId" value="${sessionScope.employee.id}"/>
				
					</fieldset>
					<div class="form-group">
						<div class="col-sm-9 col-sm-offset-3">
							<button type="reset" class="btn btn-primary draw">取消</button>
							<button type="submit" class="btn btn-primary commit">提交</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
			<div id="sidebar-right" class="box-content col-sm-2">
				<ul class="nav main-menu box-name">
				<dl >参与人</dl>
				</ul>
				<ul id="employeetTree" class="ztree"></ul>
			</div>
</div>
<script>
	$(function(){
		$(".draw").click(function(){
			$("input[class='status']").attr("value",0);
		})
		$(".commit").click(function(){
			console.log("click");
			$("input[class='status']").attr("value",2);
		})
		$("#announcement").addClass("active");
		$("#announcement").addClass("active-parent");
		$("#announcement ul li:nth-child(2)").addClass("active");
		$("#announcement").find("ul").show();
	})
</script>